
public class ModelPanelMapSelector extends AbstractModel {

	private Integer selectedMapIndex;
	
	/*
	 * Constructor
	 */
	public ModelPanelMapSelector() {
		selectedMapIndex = 0;
	}
	
	/*
	 * Mutators
	 */
	public void setSelectedMapIndex(Integer mI) {
		System.out.println(this.getClass().toString() + ".setSelectedMapIndex() called");
		Integer oldSelectedMapIndex;
		if(selectedMapIndex == null)
			oldSelectedMapIndex = -1;
		else
			oldSelectedMapIndex = selectedMapIndex;
		selectedMapIndex = mI;
		
		/*
		 * Check the size of mapsList
		 */
		if(selectedMapIndex < 0)
			selectedMapIndex = 0;
		else if(selectedMapIndex >= WorldWar.mapLoader.getMapsList().size())
			selectedMapIndex = WorldWar.mapLoader.getMapsList().size() - 1;
		
		firePropertyChange("selectedMapIndex", oldSelectedMapIndex, selectedMapIndex);
	}
	
	/*
	 * Accessors
	 */	
	public Integer getSelectedMapIndex() {
		return selectedMapIndex;
	}
}
